<div style="background:url(__PUBLIC__/images/login_bg.png) repeat-x;padding:0px;">
    <div style="width:1210px;height:768px;margin:0 auto;background:url(__PUBLIC__/images/login_dl.jpg) no-repeat; " >
   <div style="width:420px;height:294px;padding-top:255px;margin-left:394px"> 
       <form class="form-horizontal">
        <div class="form-group" style="padding-left:13px;">
          <label for="inputEmail3" class="col-sm-3 control-label">用户名</label>
          <div class="col-sm-9">
              <input type="text" class="form-control" id="inputEmail3" style="width:80%" placeholder="用户名">
          </div>
        </div>
        <div class="form-group" style="padding-left:15px;">
            <label for="inputPassword3" class="col-sm-3 control-label">密  &nbsp;&nbsp;&nbsp;码</label>
          <div class="col-sm-9">
              <input type="password" class="form-control" id="inputPassword3" style="width:80%" placeholder="密码">
          </div>
        </div>
         <div class="form-group" style="padding-left:15px;">
          <label for="inputCaptcha3" class="col-sm-3 control-label">验证码</label>
          <div class="col-sm-9">
              <input  type="text" class="form-control" id="inputCaptcha3" placeholder="验证码" style="width:30%;float:left;margin-right: 16px;">
                  <img id="img" src="<?php echo U('index/captcha')?>" onclick="this.src='<?php echo U('index/captcha?num=rand(10,100)')?>'" width="126px" height="34px" alt="CAPTCHA" border="0" style="cursor: pointer;float:left">
          </div>
        </div>
        <div class="form-group"  style="padding-left:62px;">
          <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
              <label>
                  <input type="checkbox" id="rember">记住我
              </label>
            </div>
          </div>
        </div>
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
              <button type="button" class="btn btn-warning" style="width:120px;margin-left:76px;" id="sub">登 陆</button>
          </div>
        </div>
  </form>
  </div>      
</div>
    <!--模态框开始-->
    <div class="modal fade" tabindex="-1" role="dialog" id="myModal">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">错误提示!</h4>
      </div>
        <div class="modal-body" id="content">
        
      </div>
      <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal" id="close">Close</button>   
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!--模态框结束-->
</div>
<script>
    $(function(){
       $("#sub").click(function(){     
           login();    
       })
       
       $(document).keydown(function(event){
            var e = event ? event : window.event;
            if(e.keyCode == 13){
                login();
            }
       })
       
       function login(){
            $('#content').html('');
            var name = $("#inputEmail3").val();
            var pwd  = $("#inputPassword3").val();
            var captcha = $("#inputCaptcha3").val();
            var checked = $('#rember').prop('checked') ? 1 : 0;
            if($.trim(name) == '' || $.trim(pwd) == '' || $.trim(captcha) == ''){
                  $('#content').html('<p>请完善您的信息以登入!</p>'); 
                  $('#myModal').modal('show');
            }else{
                 $.getJSON('<?php echo U("index/login")?>',{'name':name,'pwd':pwd,'captcha':captcha,'checked':checked},function(e){              
                    if(e.status == 0){               
                      $('#content').html('<p>'+e.msg+'</p>'); 
                      $('#inputCaptcha3').val('');
                      $('#myModal').modal('show');                  
                      $('#img').click();
                   }else{
                       window.location.href=e.url;
                   }
           })
            }
       }
    })
</script>    
